package com.yami.shop.api.controller;

import com.yami.shop.config.CalculateRequest;
import com.yami.shop.config.CalculateResponse;
import com.yami.shop.service.DevicePriceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/device")
@Tag(name = "设备价格计算接口")
@AllArgsConstructor
public class DevicePriceController {

    @Autowired
    private DevicePriceService devicePriceService;

    @PostMapping("/calculatePrice")
    @Operation(summary = "计算设备总价")
    public CalculateResponse calculatePrice(@RequestBody CalculateRequest request) {
        return devicePriceService.calculatePrice(request);
    }
}
